home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt3sp1.arc / GETSCRIP.PAS < prev    next >
Pascal/Delphi Source File  |  1985-09-11  |  7KB  |  184 lines

  1. (*----------------------------------------------------------------------*)
  2. (*        Get_Script_Command --- Get command from script buffer         *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Get_Script_Command( VAR Command : PibTerm_Command_Type );
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*       Procedure:   Get_Script_Command                                *)
  10. (*                                                                      *)
  11. (*       Purpose:     Get command from script buffer                    *)
  12. (*                                                                      *)
  13. (*       Calling Sequence:                                              *)
  14. (*                                                                      *)
  15. (*          Get_Script_Command( VAR Command : PibTerm_Command_Type );   *)
  16. (*                                                                      *)
  17. (*             Command --- command extracted from buffer                *)
  18. (*                                                                      *)
  19. (*----------------------------------------------------------------------*)
  20.  
  21. VAR
  22.    L: INTEGER;
  23.  
  24. (*----------------------------------------------------------------------*)
  25. (*   Copy_Script_String --- Copy a string from the script buffer        *)
  26. (*----------------------------------------------------------------------*)
  27.  
  28. PROCEDURE Copy_Script_String( VAR S: AnyStr );
  29.  
  30. VAR
  31.    I: INTEGER;
  32.  
  33. BEGIN (* Copy_Script_String *)
  34.  
  35.    S                 := '';
  36.  
  37.    Script_Buffer_Pos := Script_Buffer_Pos + 1;
  38.  
  39.    L := Script_Buffer^[Script_Buffer_Pos];
  40.  
  41.    FOR I := 1 TO L DO
  42.       BEGIN
  43.          Script_Buffer_Pos := Script_Buffer_Pos + 1;
  44.          S := S + CHR( Script_Buffer^[Script_Buffer_Pos] );
  45.       END;
  46.  
  47. END   (* Copy_Script_String *);
  48.  
  49. (*----------------------------------------------------------------------*)
  50. (*   Copy_Script_Integer --- Copy an integer from the script buffer     *)
  51. (*----------------------------------------------------------------------*)
  52.  
  53. PROCEDURE Copy_Script_Integer( VAR IntVal: INTEGER );
  54.  
  55. VAR
  56.    Int_Bytes : ARRAY[1..2] OF BYTE ABSOLUTE IntVal;
  57.  
  58. BEGIN (* Copy_Script_Integer *)
  59.  
  60.    Int_Bytes[1] := Script_Buffer^[Script_Buffer_Pos + 1 ];
  61.    Int_Bytes[2] := Script_Buffer^[Script_Buffer_Pos + 2 ];
  62.  
  63.    Script_Buffer_Pos := Script_Buffer_Pos + 2;
  64.  
  65. END   (* Copy_Script_Integer *);
  66.  
  67. (*----------------------------------------------------------------------*)
  68.  
  69. BEGIN (* Get_Script_Command *)
  70.                                    (* Check for suspended script      *)
  71.                                    (* and exit if suspension still    *)
  72.                                    (* in progress.                    *)
  73.  
  74.    IF Script_Suspend_Time > 0.0 THEN
  75.       IF ( TimeDiffH( Script_Suspend_Start, TimeOfDayH ) >
  76.          Script_Suspend_Time ) THEN
  77.             BEGIN
  78.                Command := Null_Command;
  79.                EXIT;
  80.             END
  81.       ELSE
  82.          Script_Suspend_Time := 0.0;
  83.  
  84.                                    (* Set script strings to null      *)
  85.    Script_String       := '';
  86.    Script_String_2     := '';
  87.    Script_Integer_1    := 0;
  88.                                    (* Point to next command in buffer *)
  89.  
  90.    Script_Buffer_Pos := Script_Buffer_Pos + 1;
  91.  
  92.                                    (* Pick up command type            *)
  93.  
  94.    Command   := PibTerm_Command_Table_2[ Script_Buffer^[Script_Buffer_Pos] ];
  95.  
  96.                                    (* For commands with arguments,     *)
  97.                                    (* get the arguments.               *)
  98.    CASE Command OF
  99.  
  100.       DelaySy    : BEGIN
  101.                       Copy_Script_Integer( Script_Integer_1 );
  102.                       Delay_Time := Script_Integer_1 * 100;
  103.                    END;
  104.  
  105.       SuspendSy  : BEGIN
  106.                       Copy_Script_Integer( Script_Integer_1 );
  107.                       Script_Suspend_Time  := Script_Integer_1;
  108.                       Script_Suspend_Time  := Script_Suspend_Time / 10.0;
  109.                       Script_Suspend_Start := TimeOfDayH;
  110.                    END;
  111.  
  112.       CaptureSy,
  113.       DialSy,
  114.       DosSy,
  115.       InputSy,
  116.       KeySy,
  117.       MessageSy,
  118.       RedialSy,
  119.       STextSy,
  120.       TextSy,
  121.       TranslateSy,
  122.       WaitSy     : Copy_Script_String( Script_String );
  123.  
  124.       FileSy     : BEGIN
  125.                       Copy_Script_Integer( Script_Integer_1 );
  126.                       Copy_Script_String ( Script_String    );
  127.                       Copy_Script_String ( Script_String_2  );
  128.                    END;
  129.  
  130.       RInputSy   : BEGIN
  131.                       Copy_Script_String ( Script_String    );
  132.                       Copy_Script_Integer( Script_Integer_1 );
  133.                    END;
  134.  
  135.       IfConSy,
  136.       IfFoundSy  : BEGIN
  137.                       Copy_Script_Integer( Script_Integer_1 );
  138.                       Copy_Script_Integer( Script_Integer_2 );
  139.                       Copy_Script_Integer( Script_Integer_3 );
  140.                    END;
  141.  
  142.       IfRemStrSy,
  143.       IfLocStrSy : BEGIN
  144.                       Copy_Script_Integer( Script_Integer_1 );
  145.                       Copy_Script_Integer( Script_Integer_2 );
  146.                       Copy_Script_Integer( Script_Integer_3 );
  147.                       Copy_Script_String ( Script_String    );
  148.                    END;
  149.  
  150.       KeySendSy  : BEGIN
  151.                       Script_Buffer_Pos := Script_Buffer_Pos + 1;
  152.                       Key_No            := Script_Buffer^[Script_Buffer_Pos];
  153.                    END;
  154.  
  155.       GoToSy     : Copy_Script_Integer( Script_Integer_1 );
  156.  
  157.       WaitStrSy  : BEGIN
  158.                       Copy_Script_String ( Script_String    );
  159.                       Copy_Script_String ( Script_String_2  );
  160.                       Copy_Script_Integer( Script_Integer_1 );
  161.                       Copy_Script_Integer( Script_Integer_2 );
  162.                    END;
  163.  
  164.       WhenSy     : BEGIN
  165.                       Copy_Script_String( Script_String   );
  166.                       Copy_Script_String( Script_String_2 );
  167.                    END;
  168.  
  169.       ReceiveSy  : BEGIN
  170.                       Copy_Script_String ( Script_String    );
  171.                       Copy_Script_Integer( Script_Integer_1 );
  172.                    END;
  173.  
  174.       SendSy     : BEGIN
  175.                       Copy_Script_String ( Script_String   );
  176.                       Copy_Script_Integer( Script_Integer_1 );
  177.                    END;
  178.  
  179.       ELSE;
  180.  
  181.    END (* CASE *);
  182.  
  183. END   (* Get_Script_Command *);
  184.